<template>
  <div>
    <a-table
      :columns="columns"
      :data-source="tableData"
      :loading="loading"
      :pagination="false"
      :rowKey="(record, index) => record.id"
    >
      <template slot="action" slot-scope="text, record">
        <div>
          <a @click="handleWorkResume(record)">商品明细</a>
          <a-divider type="vertical" />
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
          <a-popconfirm
            okText="确定"
            cancelText="取消"
            title="确定删除吗?"
            @confirm="() => handleDelete(record)"
          >
            <a>删除</a>
          </a-popconfirm>
        </div>
      </template>
    </a-table>
    <!-- <GoodResume ref="GoodResume"></GoodResume> -->
    <!-- <WareEditModal ref="modalForm" @ok="modalFormOk"></WareEditModal> -->
  </div>
</template>

<script>
import { wareResumeColumns } from "./tableConfig";
import api from "@/api/apiServer";
import { tableMinxins } from "@/unit/mixins/tableMinxins.js";
import GoodResume from "./GoodResume.vue";
import WareEditModal from "./WareEditModal.vue";

export default {
  mixins: [tableMinxins],
  components: { GoodResume, WareEditModal },
  data() {
    return {
      columns: wareResumeColumns,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      model: {},
      tableData: [{ key: 1 }],
    };
  },
  mounted() {
    if (this.$route.query) {
      let query = this.$route.query;
      console.log(query);
      //       this.getDetail(query.materialPrepareNum);
      //       this.$set(this.model, "materialPrepareNum", query.materialPrepareNum);
      //       this.$set(this.model, "worksheetNum", query.worksheetNum);
      //       this.$set(this.model, "worksheetQuantity", query.worksheetQuantity);
    }
  },
  methods: {
    // 获取出库履历详情
    async getDetail(materialPrepareNum) {
      const params = {
        materialPrepareNum,
      };
      const res = await api.OutStoreRecord(params);
      this.tableData = res.data;
    },
    //  编辑
    handleEdit(record) {
      this.$refs.modalForm.title = "编辑";
      this.$refs.modalForm.modalEdit(record);
    },
    // 商品明细
    handleWorkResume(record) {
      this.$refs.GoodResume.showDrawer(record);
    },
    handleReceiving(record) {
      this.$router.push({ path: "/ware/receiving" });
    },
  },
};
</script>
